﻿@section header{

}
<form id="form1">
    <div class="form-layout">
        <table class="form">
            <tr>
                <th class="formTitle">按钮名称</th>
                <td class="formValue">
                    <input id="Name" name="Name" type="text" class="form-control required" placeholder="请输入名称" />
                </td>
                <th class="formTitle">按钮ID</th>
                <td class="formValue">
                    <input id="DomId" name="DomId" type="text" class="form-control required" placeholder="请输入编号" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">属性</th>
                <td class="formValue">
                    <input id="Attr" name="Attr" type="text" class="form-control" />
                </td>
                <th class="formTitle">连接</th>
                <td class="formValue">
                    <input id="Script" name="Script" type="text" class="form-control" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">图标</th>
                <td class="formValue">
                    <input id="Icon" name="Icon" type="text" class="form-control" />
                </td>
                <th class="formTitle">排序</th>
                <td class="formValue">
                    <input id="OrderBy" name="OrderBy" type="text" class="form-control required" />
                </td>
            </tr>
            <tr>
                <th class="formTitle" valign="top" style="padding-top: 5px;">
                    描述
                </th>
                <td class="formValue" colspan="3">
                    <textarea id="Remark" name="Remark" class="form-control" style="height: 100px;"></textarea>
                </td>
            </tr>
        </table>
    </div>
</form>
@section scripts{
    <script>
        var keyValue = $.request("keyValue");
        var moduleId = $.request("moduleId");
        $(function () {
            initControl();
            if (!!keyValue) {
                $.ajax({
                    url: "/rbac/MenuElement/GetFormJson",
                    data: { keyValue: keyValue },
                    dataType: "json",
                    async: false,
                    type: "POST",
                    success: function (data) {
                        $("#form1").formSerialize(data);
                    }
                });
            }
        });
        function initControl() {
            $("#Location").select2({ minimumResultsForSearch: -1 });
        }
        function submitForm() {
            if (!$('#form1').formValid()) {
                return false;
            }
            var postData = $("#form1").formSerialize();
            postData["ModuleId"] = moduleId;
            $.submitForm({
                url: "/rbac/MenuElement/SubmitForm?keyValue=" + keyValue,
                param: postData,
                success: function () {
                    top.modulebutton.$("#gridList").resetSelection();
                    top.modulebutton.$("#gridList").trigger("reloadGrid");
                }
            })
        }
    </script>
}